package listbyorder.access201_300.test371;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/7/1 22:23
 */
public class Solution1 {

    public int getSum(int a, int b) {
        if (a == 0) return b;
        if (b == 0) return a;
        int lower;
        int carrier;
        while (true) {
            lower = a ^ b;
            carrier = a & b;
            if (carrier == 0) break;
            a = lower;
            b = carrier << 1;
        }
        return lower;
    }
}
